/*    */ package com.newcrm.webapi.sub;
/*    */ 
/*    */ import com.newcrm.bean.User;
/*    */ import com.newcrm.db.ExportTaskManager;
/*    */ import com.newcrm.exception.NotFoundException;
/*    */ import com.newcrm.manager.ExportManager;
/*    */ import com.newcrm.util.Util;
/*    */ import com.newcrm.webapi.AbstractAction;
/*    */ import com.newcrm.webapi.AbstractHttpServlet;
/*    */ import java.io.IOException;
/*    */ import java.io.PrintWriter;
/*    */ import javax.servlet.ServletException;
/*    */ import javax.servlet.http.HttpServletRequest;
/*    */ import javax.servlet.http.HttpServletResponse;
/*    */ import net.sf.json.JSONObject;
/*    */ 
/*    */ public class DeleteExportTask extends AbstractAction
/*    */ {
/* 22 */   private String filePath = null;
/*    */ 
/*    */   public DeleteExportTask(AbstractHttpServlet servlet, String filePath) {
/* 25 */     super(servlet);
/* 26 */     this.filePath = filePath;
/*    */   }
/*    */ 
/*    */   public void parse(HttpServletRequest request, HttpServletResponse response)
/*    */     throws IOException, ServletException, NotFoundException
/*    */   {
/* 32 */     User u = super.getLoginUser(request);
/* 33 */     int exportTaskId = Util.getURLIntParameter(request
/* 34 */       .getParameter("exportTaskId"));
/*    */ 
/* 36 */     ExportTaskManager manager = new ExportTaskManager();
/*    */ 
/* 38 */     int num = manager.delete(exportTaskId, u.userId);
/* 39 */     if (num > 0) {
/* 40 */       ExportManager.getInstance(this.filePath).clearTask(exportTaskId);
/*    */     }
/*    */ 
/* 43 */     response.setContentType("text/html;charset=utf-8");
/* 44 */     PrintWriter out = response.getWriter();
/* 45 */     JSONObject jsonObject = new JSONObject();
/* 46 */     jsonObject.put("error", "0");
/* 47 */     if (num > 0)
/* 48 */       jsonObject.put("deleteTaskId", Integer.valueOf(exportTaskId));
/*    */     else {
/* 50 */       jsonObject.put("deleteTaskId", Integer.valueOf(-1));
/*    */     }
/* 52 */     out.println(jsonObject);
/* 53 */     out.flush();
/* 54 */     out.close();
/*    */   }
/*    */ }

/* Location:           C:\E\referenceProject\CRM参考\qikebao\WEB-INF\lib\qikebao.jar
 * Qualified Name:     com.newcrm.webapi.sub.DeleteExportTask
 * JD-Core Version:    0.6.1
 */